#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
char* my_strncpy(char* p1, const char* p2, size_t num)
{
	char* star = p1;
	int i = 0;
	for (i = 0; i < num; i++)
	{
		*(p1 + i) = *(p2 + i);
	}
	*(p1 + i) = '\0';
	return star;

}
int main()
{
	char arr1[] = "abcdefg";
	char arr2[20] = { 0 };
	char* p1 = my_strncpy(arr2, arr1, 4);
	printf("%s\n",p1);
	return 0;
}